From: Albert Astals Cid Date: Wed, 26 Mar 2025 10:26:32 +0000 (+0100) Subject: Make sure regex doesn't stack overflow by limiting it X-Git-Tag: archive/raspbian/25.03.0-5+rpi1+deb13u3^2~2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=760e57ea9cb9c35cdd08957bd63da2b6dcb42b6d;p=poppler.git Make sure regex doesn't stack overflow by limiting it Origin: https://gitlab.freedesktop.org/poppler/poppler/-/commit/f54b815672117c250420787c8c006de98e8c7408 Bug-Debian: https://bugs.debian.org/1117046 Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2025-43718 Happens with very long pdfsubver strings when compiled with -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -flto=auto Gbp-Pq: Name Make-sure-regex-doesn-t-stack-overflow-by-limiting-i.patch --- diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 7294d2c..3bfbeba 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -479,7 +479,7 @@ static PDFSubtypePart pdfPartFromString(PDFSubtype subtype, const std::string &p static PDFSubtypeConformance pdfConformanceFromString(const std::string &pdfsubver) { - const std::regex regex("PDF/(?:A|X|VT|E|UA)-[[:digit:]]([[:alpha:]]+)"); + const std::regex regex("PDF/(?:A|X|VT|E|UA)-[[:digit:]]([[:alpha:]]{1,3})"); std::smatch match; // match contains the PDF conformance (A, B, G, N, P, PG or U)